package com.andnnl.table;

/**
 * Created by chenss on 2021/7/8.
 */
public class DeleteTableTest {
    public static void main(String[] args) {
//        test1();
//        test2();
        test3();
    }

    private static void test1() {
        //TBL_SMS_LONG_MSGID_202008_61
        for (int i = 202101; i <= 202112; i++) {
            for (int j = 0; j <= 99; j++) {
                String s = "drop table TBL_SMS_LONG_MSGID_" + i + "_" + fm(j) + ";";
                System.out.println(s);
            }
        }
    }

    private static String fm(int j) {
        return j < 10 ? "0" + j : "" + j;
    }

    private static void test2() {
        //TBL_SMS_LONG_MSGID_202008_61
        for (int j = 0; j <= 99; j++) {
            String aa = j < 10 ? "0" + j : "" + j;
            String s = "delete FROM [EMAS_SMS].[dbo].[TBL_SMS_LONG_MSGID_" + aa + "] where [createTime] < '2021-01-01';";
            System.out.println(s);
        }
    }

    private static void test3() {
        //TBL_SMS_LONG_MSGID_202008_61
        for (int j = 0; j <= 99; j++) {
            String aa = j < 10 ? "0" + j : "" + j;
            String s = "db.getCollection('tbl_sms_long_msgid_" + aa + "').createIndex({\"msgId\":-1},{background:true});\n" +
                    "db.getCollection('tbl_sms_long_msgid_" + aa + "').createIndex({\"parentMsgId\":-1},{background:true});";
            System.out.println(s);
        }
    }
}
